package com.qingke.oms.factory;

import com.qingke.oms.command.Command;
import com.qingke.oms.pojo.Shop;
import com.qingke.oms.pojo.User;

public abstract class CommandFactory {
	public static enum CommandCode{
		//system
		LOGIN,
		REGISTER,
		HELP,
		EXIT,
		//user
		NEWGOODS,
		NEWGOODSTYPE,
		NEWMANUFACTURER,
		RECEIVE,
		GOTOSHOP,
		PAY,
		RECHARGE,
		REGISTERSHOP,
		LISTALLSHOP,
		LISTMYSHOP,
		//shop
		ADD,
		DELETE,
		DELIVERY,
		EMPTY,
		LEAVE,
		OFFSHELF,
		ONSHELF,
		ORDER,
		STATUS,
		GOODS,
		CART,
		SETPRICE
		
	}
	public static CommandFactory getFactory(User user,Shop shop){
		if(user!=null&&shop!=null)
			return new ShopCommandFactory(user,shop);
		if(user!=null){
			return new UserCommandFactory(user);
		}
		return new SystemCommandFactory();
	}
	public abstract Command buildCommand(CommandCode cmdCode);
}
